@extends("la.layouts.app")

@section("contentheader_title", "打赏订单管理")
@section("contentheader_description", "打赏订单管理")
@section("section", "打赏订单管理")
@section("sub_section", "Listing")
@section("htmlheader_title", "打赏订单管理")

@section("headerElems")
    {{--@la_access("Organizations", "create")--}}
    {{--<button class="btn btn-success btn-sm pull-right" data-toggle="modal" data-target="#AddModal">Add Organization</button>--}}
    {{--@endla_access--}}
@endsection

@section("main-content")

    @if (count($errors) > 0)
        <div class="alert alert-danger">
            <ul>
                @foreach ($errors->all() as $error)
                    <li>{{ $error }}</li>
                @endforeach
            </ul>
        </div>
    @endif

    <div class="box box-success">
        <div class="box-body">
            <div id="example1_wrapper" class="dataTables_wrapper form-inline dt-bootstrap no-footer">
                <div class="row">
                    <div class="col-sm-12">
                        <table id="example1" class="table table-bordered dataTable no-footer" role="grid"
                               aria-describedby="example1_info">
                            <thead>
                            <tr class="success" role="row">
                                <th class="" tabindex="0">
                                    id
                                </th>
                                <th class="" tabindex="0">
                                    观众
                                </th>
                                <th class="" tabindex="0">
                                    状态
                                </th>
                                <th class="" tabindex="0">
                                    上传资源标题
                                </th>
                                <th class="" tabindex="0">
                                    订单号
                                </th>
                                <th class="" tabindex="0">
                                    订单金额
                                </th>
                                <th class="" tabindex="0">
                                    资源上传者
                                </th>
                            </tr>
                            </thead>
                            <tbody>
                            @foreach($orders as $order)
                                <tr role="row" class="odd">
                                    <td class="_1">{{ $order->id }}</td>
                                    <td>
                                        {{ $order->openid }}
                                        <br/>
                                        {{ $order->member ? $order->member->sex : '-' }}{{ $order->member ? $order->member->nickname : '-' }}
                                        <br/>
                                        <img src="{{ $order->member ? $order->member->avatar : '-' }}" alt="" style="width: 64px;height: 64px;">
                                    </td>
                                    <td>{{ $order->status_word }}</td>
                                    <td>
                                        <a href="/admin/wechat-upload/{{ $order->wechat_upload_id }}">
                                            {{ $order->wechat_upload ? $order->wechat_upload->title : '-' }}
                                        </a>
                                    </td>
                                    <td>{{ $order->number }}</td>
                                    <td>{{ $order->amount }}</td>
                                    <td>
                                        {{ $order->wechat_upload ? ($order->wechat_upload->member ? $order->wechat_upload->member->sex : '-') : '-' }}
                                        {{ $order->wechat_upload ? ($order->wechat_upload->member ? $order->wechat_upload->member->nickname : '-') : '-' }}<br/>
                                        <img src="{{ $order->wechat_upload ? ($order->wechat_upload->member ? $order->wechat_upload->member->avatar : '-') : '-' }}" alt="" style="width: 64px;height: 64px;">
                                    </td>
                                </tr>
                            @endforeach
                            </tbody>
                        </table>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-5">
                        <div class="dataTables_info" id="example1_info" role="status" aria-live="polite">
                            一共{{ $orders->total() }}个
                        </div>
                    </div>
                    <div class="col-sm-7" style="padding-right: 20px;">
                        <div class="dataTables_paginate paging_simple_numbers" id="example1_paginate">
                            {!! $orders->render() !!}
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

@endsection

@push('styles')
    <link rel="stylesheet" type="text/css" href="{{ asset('la-assets/plugins/datatables/datatables.min.css') }}"/>
@endpush

@push('scripts')
    <script src="{{ asset('la-assets/plugins/datatables/datatables.min.js') }}"></script>
@endpush